package com.education.platform.api.service.impl;

import com.education.platform.api.service.AccountFlowService;

import com.education.platform.common.enums.MemberTypeEnum;

import com.education.platform.dao.entity.AccountDO;
import org.springframework.beans.factory.annotation.Autowired;
import com.education.platform.common.service.impl.BaseServiceImpl;
import com.education.platform.dao.AccountDao;
import org.springframework.stereotype.Service;
import com.education.platform.api.service.AccountService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
* describe: 账户
* @author : tomato
* @date: 2020-06-06 02:55:51.638
**/
@Service
public class AccountServiceImpl extends BaseServiceImpl<AccountDao, AccountDO> implements AccountService {

	private static final Logger LOGGER = LoggerFactory.getLogger(AccountServiceImpl.class);

    @Autowired
	private AccountDao accountDao;







    /**
     * 是否是vip用户
     *
     * @return
     */
    @Override
    public boolean isVip(Integer userId) {
        if(userId != null){
            AccountDO query = new AccountDO();
            query.setUserId(userId);
            query.setDeleted(false);
            AccountDO accountDO = accountDao.get(query);
            if(accountDO !=null && MemberTypeEnum.VIP.getValue().equals(accountDO.getMemberType())){
                return true;
            }
        }
        return false;
    }
}
